#ifndef DATABASE_H
#define DATABASE_H
#include <QSqlDatabase>
#include <QSqlQuery>
#include <QObject>
static bool createConnection()
{
//    QSqlDatabase db=QSqlDatabase::addDatabase("QSQLITE");

//    db.setDatabaseName("/home/maowendi/mao/Project/Qt/QSqlite_test/EasyChat.db");
    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName("waterData.db");
    if(!db.open()) return false;
    QSqlQuery query;
    query.exec(QObject::tr("create table user (id int, name vchar primary key,passWord vchar)"));
    query.exec(QObject::tr("insert into user values (1,'Tom',999)"));
    query.exec(QObject::tr("insert into user values (2,'Lily',888)"));
    query.exec(QObject::tr("insert into user values (3,'Lucy',666)"));
    query.exec(QObject::tr("insert into user values (4,'小强',555)"));
return true;
}
#endif // DATABASE_H
